import QtQuick 1.0

Dialog {
    id: driveSelectionDialog
    property bool source: false
    title: "Select drive"

    Column {
        id: drivesContainer
        height: driveSelectionDialog.height
        anchors.top: driveSelectionDialog.top
        anchors.topMargin: root.constants.dialogTitleHeight +
                           root.constants.defaultMargin
        anchors.horizontalCenter: parent.horizontalCenter
        spacing: root.constants.defaultLayoutSpacing

        Repeater {
            model: driveModel

            delegate: Button {
                id: driveButton
                width: driveSelectionDialog.width * 2 / 3
                height: root.constants.fileListModelItemHeight

                Text {
                    anchors.centerIn: parent
                    color: root.constants.defaultForegroundColor
                    text: volume
                }

                onTapped: {
                    if (driveSelectionDialog.source) {
                        // Set source drive.
                        engine.setSourceDrive(index);
                    }
                    else {
                        // Set target drive.
                        engine.setTargetDrive(index);
                    }

                    driveSelectionDialog.doClose();
                }
            }
        }
    }
}

// End of file.
